package com.hanwei.uap.acceptors.sstn.server;

import com.hanwei.uap.acceptors.sstn.coder.MessageDecoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import org.springframework.stereotype.Component;

/**
 * 使用自定义分隔符解码器
 *
 * @author zhaoam
 * @create 2017-08-07 18:58
 **/
@Component
public class CustomServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new MessageDecoder());
        pipeline.addLast(new NettyServerHandler());
    }
}
